/*! \file variables.h
 *  \brief A simple list for storing variables 
 *  \author Lluis Garrido
 *
 *  This file contains the structures necessary for
 *  storing an array of variables. 
 */

#ifndef VARIABLES_H
#define VARIABLES_H

#include "eval_expr.h"

/*! \def VARIABLE_ID_NONE
 *  \brief Reserved for identifying no variable in field variable_id of struct variable.
 */
#define VARIABLE_ID_NONE      0

/*! \struct variable 
 *  \brief A structure used to store variables.
 *  
 *  A structure used to store variables. The structure stores, for each varible,
 *  - The name (a string) of the associated variable
 *  - A unique identifier for the variable (see ::list_variables_set_variable, ::list_variables_get_variable_id)
 *  - The numerical value associated to the variable (see ::list_variables_get_value)
 *
 */

struct variable
{
  unsigned int variable_id; /*!< A unique identifier for the variable */
  char name[MAX_SIZE_VARIABLE]; /*!< The name of the variable */
  double value; /*!< The numerical value associated to the variable */
};

/*! \struct list_variables 
 *  \brief A structure used to store a list of variables.
 *
 *  The structure holds an array of struct variable. In addition,
 *  the structure holds a member called currid. This member is
 *  used to assign a unique identifier when creating (i.e. inserting)
 *  new variables to the list.
 *
 */

struct list_variables
{
  int nitems;  /*!< Maximum number of variables that can be stored in the array el */
  int currid;     /*!< First identifier available when inserting new variables to the list */
  struct variable *el;  /*!< The array of variables */
};

#endif
